﻿@using CID.Web.Support
@model CID.Web.Models.Infrastructure.TemplateViewModel

<script src="@Url.Content("~/Scripts/codemirror.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/codemirror.xmlpure.js")" type="text/javascript"></script>

@Html.KOTextAreaFor(m => m.Content, new { @class = "template-content-xml-editor" })

<script type="text/javascript">
    $(document).ready(function () {
        $(".template-content-xml-editor").each(function (index, element) {
            var editor = CodeMirror.fromTextArea(element, {
                mode: { name: "xmlpure" },
                lineNumbers: true
            });
            editor.setOption("onBlur", function () {
                viewModel.Content(editor.getValue());
            });
        });
    });
</script>